/*两数之和 https://leetcode-cn.com/problems/two-sum/  */
/*部分代码参考评论区或者题解，如有侵权请及时联系删除!*/
package com.chen.Leet;

import java.util.Arrays;

public class Solution {
	 public static int[] twoSum(int[] nums, int target) {
	        int[] out=new int[2];
	        for(int i=0;i<nums.length;i++){
	            for(int j=i+1;j<nums.length;j++){
	                if(nums[i]+nums[j]==target){
	                  out[0]=i;
	                  out[1]=j;
	                  return out;
	                };
	            };
	        };
	        return out;
	    };
    public static void main(String[] args) {
    	int nums[]= {2,4,5,5};
    	int result[]=twoSum(nums,10);
    	System.out.println(Arrays.toString(result));
    	
	}

}
